<template>
	<view>
		<view class="h400">
			<image :src="$config.homepage_img||''" class="wh-max" mode="aspectFill" />
		</view>
		<view class="p20 pr z-index1 " style="margin-top: -100rpx;">
			<view class="bg-fff p20 radius20">
				<view class="fw-w  mb20">开通说明</view>
				<u-parse :html="$config.homepage_tips" :domain="$baseUrl"></u-parse>
			</view>
			<view class="bg-fff p20 radius20 mt20">
				<view class="fw-w  mb20">支付费用</view>
				<view class="pt20 pb20  flex-col col-center">
					<view class="fw-w fs36">限时折扣</view>
					<view class="mt20 flex">
						<text class="fw-w fs48 ">￥{{$config.homepage_price}}</text>
						<text class="ml10 td-c">￥{{$config.homepage_price2}}</text>
					</view>
				</view>
			</view>
			<view class="bg-fff p20 radius20 mt20">
				<view class="fw-w  mb20">示例效果</view>
				<image :src="$config.homepage_example||''" class="w-max h0" mode="widthFix" />
			</view>
		</view>
		<view class="h120"></view>
		<view class="pf bottom0 left0 w-max p20 bg-fff z-index2">
			<u-button type="warning" ripple v-if="$user.is_homepage==1" @click="share">已开通 去分享</u-button>
			<u-button type="warning" @click="submit" ripple v-else>确认开通</u-button>
		</view>
		<payment ref="pay" @success="$getUser()"  depositShow/>
	</view>
</template>

<script>
	export default {
		data() {
			return {

				data: ''
			}
		},
		onLoad(e) {},
		methods: {
			async submit() {
				if (this.$user.is_name_auth == -1) {
					await this.$showModal('提示', '未实名,是否去实名')
					this.$jump('/pages/my/set/autonym')
				} else {
					this.$refs.pay.open({
						money: this.$config.homepage_price,
						target_type: 'homepage'
					})
				}
			},
			share() {
				// #ifdef MP-WEIXIN
				this.$request('/master/team/share').then(res => {
					wx.navigateToMiniProgram({
						appId: 'wxc1f8f8a8aa452356', //要打开的小程序appid
						path: '/pages/index/index?masterid=' + this.$user.id, //要打开另一个小程序的页面和传递的参数
						envVersion: 'trial', //打开小程序的版本（体验版trial；开发版develop；正式版release）
						...res.data,
						success(res2) {
							// ·· //打开成功之后事件
						}
					})
				})
				// #endif
				// #ifndef MP-WEIXIN
				let share = this.$baseUrl + '/h5/#/?masterid=' + this.$user.id
				this.$tool.copy(share, '已复制分享链接 去分享给好友吧')
				// #endif
			}
		}
	}
</script>

<style>

</style>